package com.jswzc.common.api.controller;

import com.jswzc.api.service.smsUnified.SmsUnifiedServiceI;
import com.jswzc.framework.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by DeathCat on 2017/5/12.
 */
@Controller
@RequestMapping("/smsUnified")
public class SmsUnifiedController extends BaseController {

    @Resource(name = "smsUnifiedService")
    private SmsUnifiedServiceI smsUnifiedService;

    @RequestMapping(value = "/sendSmsTest")
    public void sendSmsTest(HttpServletResponse response, HttpServletRequest request, String mobile, String content, String smsCode,String smsAuthorCode) throws IOException {
        Map<String, Object> res = new HashMap<String, Object>();
        try {
            res = smsUnifiedService.sendSms(mobile, content, smsCode, smsAuthorCode);
        } catch (Exception e) {
            res.put("res", "F");
            res.put("msg", "未知错误:" + e.getMessage());
        }
        writeJson(res, response);
    }


}
